package org.jeecg.entity.meter;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.entity.basedata.BaseFloor;
import org.jeecg.entity.basedata.BaseRoom;
import org.jeecg.enums.meter.MeterTypeEnum;
import org.jeecg.enums.meter.MeterUseStatusEnum;
import org.jeecg.modules.system.entity.BaseEntity;
import org.jeecg.vo.meter.FloorResVo;
import org.jeecg.vo.meter.MeterAddressAddVo;
import org.jeecg.vo.meter.roomResVo;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Description: 水电表基础信息
 * @Author: liurui
 * @Date:   2020-11-20
 * @Version: V1.0
 */
@Data
@TableName("meter")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="meter对象", description="水电表基础信息")
public class Meter extends BaseEntity {
	/**表编号*/
	@Excel(name = "设备号/地址", width = 15)
	@ApiModelProperty(value = "设备号设备号/地址")
	private String meterCode;
	@ApiModelProperty(value = "采集器地址")
	@Excel(name = "采集器地址", width = 15)
	private  String collectorAddress;
	/**初始金额*/
	@Excel(name = "初始金额", width = 15)
    @ApiModelProperty(value = "初始金额")
	private String beginAmount;
	/**初始用量*/
	@Excel(name = "初始读数", width = 15)
    @ApiModelProperty(value = "初始读数")
	private String beginUse;
	/**通断状态（1:通 2:断）*/
	@Excel(name = "通断状态（1:通 2:断）", width = 15)
	@ApiModelProperty(value = "通断状态（1:通 2:断）")
	@Dict(dicCode = "switch_status")
	private Integer switchStatus;
	/**欠费通断用量*/
	@Excel(name = "欠费通断量", width = 15)
	@ApiModelProperty(value = "欠费通断量")
	private Integer switchUse;
	/**线损*/
	@Excel(name = "线损", width = 15)
	@ApiModelProperty(value = "线损")
	private String loss;
	/**倍率*/
	@Excel(name = "倍率", width = 15)
	@ApiModelProperty(value = "倍率")
	private Integer rate;
	/**设备网关*/
	@Excel(name = "设备网关", width = 15)
	@ApiModelProperty(value = "设备网关")
	private String meterGateway;
	@Excel(name = "表类型", width = 15)
	@ApiModelProperty(value = "表类型")
	@TableField(exist = false)
	private String mType;
	/**以下前台反选集合*/
	@Excel(name = "收费项", width = 15)
	@ApiModelProperty(value = "收费项")
	@TableField(exist = false)
	private String meterFee;
	/**创建者id*/
	@ApiModelProperty(value = "创建者")
	private String createBy;
	/**创建时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
	private Date createTime;
	/**删除标识(0:正常   1：删除)*/
	@ApiModelProperty(value = "删除标识(0:正常   1：删除)")
	private Integer delFlag;
	/**id*/
	@TableId(type = IdType.ID_WORKER_STR)
    @ApiModelProperty(value = "id")
	private String id;
	/**表类型(1：电表   2：水表)*/
	private Integer meterType;
	/**表名称*/
	@Excel(name = "设备名称", width = 15)
    @ApiModelProperty(value = "设备名称")
	private String name;

	@ApiModelProperty(value = "第三方唯一识别号")
	private String meterKey;
	/**在线状态(1:在线  2:不在线)*/
	@Excel(name = "在线状态(1:在线  2:不在线)", width = 15)
    @ApiModelProperty(value = "在线状态(1:在线  2:不在线)")
	private Integer onlineStatus;
	/**项目小区id*/
     @ApiModelProperty(value = "项目小区id")
	private String projectId;
	/**项目小区名称*/
	@Excel(name = "项目名称", width = 15)
    @ApiModelProperty(value = "项目名称")
	private String projectName;

	/**备注*/
	@Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
	private String remarks;
	private String phone ;
	/**物业公司ID*/

    @ApiModelProperty(value = "物业公司ID")
	private String tenantId;
	/**修改者id*/

    @ApiModelProperty(value = "修改者id")
	private String updateBy;
	/**修改时间*/

	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "修改时间")
	private Date updateTime;
	/**使用状态(0：正常  1：停用  2：封存 3：已换表)*/
	@Excel(name = "使用状态", width = 15)
    @ApiModelProperty(value = "使用状态(0：正常  1：停用  2：封存 3：已换表)")
	private Integer useStatus;
	@Dict(dicCode = "sync_status")
	@ApiModelProperty(name = "同步状态(0:未同步  1:已同步)")
	private Integer syncStatus;
	/**预警状态（0：否   1：是）*/
	@Excel(name = "预警状态（0：否   1：是）", width = 15)
    @ApiModelProperty(value = "预警状态（0：否   1：是）")
	private Integer warningStatus;
	/**预警用量*/
	@Excel(name = "预警用量", width = 15)
    @ApiModelProperty(value = "预警用量")
	 private Integer warningUse;
	@Excel(name = "地址", width = 15)
	@TableField(exist = false)
	private String address;
	@TableField(exist = false)
	private String floorId;
	@Excel(name = "楼宇", width = 15)
	@ApiModelProperty(value = "楼宇")
	@TableField(exist = false)
	private String floorName;
	@Excel(name = "房间", width = 15)
	@ApiModelProperty(value = "房间")
	@TableField(exist = false)
	private String roomName;
	@TableField(exist = false)
	private String roomId;
    @TableField(exist = false)
    private List<BaseRoom> roomList;
	@TableField(exist = false)
	private String remainAmount;
	@TableField(exist = false)
	private String remainUse;
	@TableField(exist = false)
	private String totalUse;
	@TableField(exist = false)
	private BigDecimal price;
	@TableField(exist = false)
	private Integer precision;
	@TableField(exist = false)
	private String meterGatewayName;
	@TableField(exist = false)
    private List<BaseFloor> floorList;
	@TableField(exist = false)
    private List<MeterGateway> gateWayList;
	@TableField(exist = false)
	private List<MeterFeeRule> meterFeeRuleList;
	@TableField(exist = false)
	private  String projectCode;
	//最后读表时间table展示
	@TableField(exist = false)
	private Date lastReadTime;
	//最新读数table展示
	@TableField(exist = false)
	private String newRead;
	@TableField(exist = false)
	private MeterAddressAddVo meterAddressAddVo;
	@TableField(exist = false)
	private List<FloorResVo> floorResList;
	@TableField(exist = false)
	private List<roomResVo> roomResVoList;
	@TableField (exist = false)
	private List<String> payItem;
	@TableField(exist = false)
	private List<String> roomIdList;
	@TableField(exist = false)
	private List<String> floorIdList;
	//总充值金额
	@TableField(exist = false)
	private String amount;
	@TableField(exist = false)
	private MeterRead meterRead;
	@TableField(exist = false)
	private Integer roundModal;
	@TableField(exist = false)
	private String readStartTime;
	@TableField(exist = false)
	private String readEndTime;
	@TableField(exist = false)
	private Integer minNum;
	@TableField(exist = false)
	private Integer maxNum;
	//是否欠费
    @TableField(exist = false)
	private Integer isArrearage;

	/**计量单位*/
	@TableField(exist = false)
	private String unit;

	public String getUnit() {
		return MeterTypeEnum.getUnit(this.meterType);
	}

	public String getMeterTypeName() {
		return MeterTypeEnum.getDesc(this.getMeterType());
	}

	public String getUseStatusName() {
		return MeterUseStatusEnum.getDesc(this.getUseStatus());
	}

}
